# -*- coding: UTF-8 -*-
# encoding=utf-8

import sys
import ssl
from dolphin.config.confighelper import confighelper
from dolphin.common.dolphinhttpclient import dolphinhttpclient
from dolphin.common.commonlogger import commonlogger

ssl._create_default_https_context = ssl._create_unverified_context

type = sys.getfilesystemencoding()


#from Scrapy.cmdline import execute
logger = commonlogger().getlogger()


class WordRest:
    def __init__(self):
        return

    def get_query_key_word_by_restservice(self):
        url = confighelper.getGlobalValue(
            self, 'rest_service_address') + "/spider/api/v1/word"
        query_result = dolphinhttpclient.get_response_data(
            dolphinhttpclient, url)
        response = query_result["data"]
        return response

    def put_query_key_word_by_restservice(self, data):
        url = confighelper.getGlobalValue(
            self, 'rest_service_address') + "/spider/api/v1/word"
        query_result = dolphinhttpclient.put(dolphinhttpclient, url, data)
        response = query_result.data
        return response
